@model WishlistModel
@using SDF.Core
@using SDF.Core.Domain.Tax
@using SDF.Core.Infrastructure
@using SDF.Web.Models.ShoppingCart
@{
    Layout = "~/Views/Shared/_ColumnsOne.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Wishlist").Text);
    //page class
    Html.AppendPageCssClassParts("html-wishlist-page");

    var webHelper = EngineContext.Current.Resolve<IWebHelper>();
}
<div class="page wishlist-page">
   <div class="page-title">
       <h1>
           @if (Model.IsEditable)
           {
               @T("Wishlist")
           }
           else
           {
               @String.Format(T("Wishlist.WishlistOf").Text, Model.CustomerFullname)
           }
       </h1>
   </div>
   <div class="page-body"> 
       @if (Model.Items.Count > 0)
       {
           <div class="wishlist-content">
               @if (Model.Warnings.Count > 0)
               {
               <div class="message-error">
                   <ul>
                       @foreach (var warning in Model.Warnings)
                       {
                           <li>@warning</li>
                       }
                   </ul>
               </div>
               }
               @using (Html.BeginRouteForm("Wishlist", FormMethod.Post))
               {
               <div class="table-wrapper">
                   <table class="cart">
                       <colgroup>
                           @if (Model.IsEditable)
                           {
                               <col width="1" />
                           }
                           @if (Model.DisplayAddToCart)
                           {
                               <col width="1" />
                           }
                           @if (Model.ShowSku)
                           {
                               <col width="1" />
                           }
                           @if (Model.ShowProductImages)
                           {
                               <col width="1" />
                           }
                           <col />
                           <col width="1" />
                           <col width="1" />
                           <col width="1" />
                       </colgroup>
                       <thead>
                           <tr>
                               @if (Model.IsEditable)
                               {
                                   <th class="remove-from-cart">
                                       @T("ShoppingCart.Remove")
                                   </th>
                               }
                               @if (Model.DisplayAddToCart)
                               {
                                   <th class="add-to-cart">
                                       @T("ShoppingCart.AddToCart")
                                   </th>
                               }
                               @if (Model.ShowSku)
                               {
                                   <th class="sku">
                                       @T("ShoppingCart.SKU")
                                   </th>
                               }
                               @if (Model.ShowProductImages)
                               {
                                   <th class="product-picture">
                                       @T("ShoppingCart.Image")
                                   </th>
                               }
                               <th class="product">
                                   @T("ShoppingCart.Product(s)")
                               </th>
                               <th class="unit-price">
                                   @T("ShoppingCart.UnitPrice")
                               </th>
                               <th class="quantity">
                                   @T("ShoppingCart.Quantity")
                               </th>
                               <th class="subtotal">
                                   @T("ShoppingCart.ItemTotal")
                               </th>
                           </tr>
                       </thead>
                       <tbody>
                           @foreach (var item in Model.Items)
                           {
                               <tr>
                                   @if (Model.IsEditable)
                                   {
                                       <td class="remove-from-cart">
                                           <label class="td-title">@T("ShoppingCart.Remove"):</label>
                                           <input type="checkbox" name="removefromcart" value="@(item.Id)" />
                                       </td>
                                   }
                                   @if (Model.DisplayAddToCart)
                                   {
                                       <td class="add-to-cart">
                                           <label class="td-title">@T("ShoppingCart.AddToCart"):</label>
                                           <input type="checkbox" name="addtocart" value="@(item.Id)" />
                                       </td>
                                   }
                                   @if (Model.ShowSku)
                                   {
                                       <td class="sku">
                                           <label class="td-title">@T("ShoppingCart.SKU"):</label>
                                            <span class="sku-number">@item.Sku</span>
                                       </td>
                                   }
                                   @if (Model.ShowProductImages)
                                   {
                                       <td class="product-picture">
                                           <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })"><img alt="@item.Picture.AlternateText" src="@item.Picture.ImageUrl" title="@item.Picture.Title" /></a>
                                       </td>
                                   }
                                   <td class="product">
                                       <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" class="product-name">@item.ProductName</a>
                                       @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                       {
                                           <div class="attributes">
                                               @Html.Raw(item.AttributeInfo)
                                           </div>
                                       }
                                       @if (!String.IsNullOrEmpty(item.RecurringInfo))
                                       {
                                           <div class="recurring-info">
                                               @Html.Raw(item.RecurringInfo)
                                           </div>
                                       }
                                       @if (!String.IsNullOrEmpty(item.RentalInfo))
                                       {
                                           <div class="rental-info">
                                               @Html.Raw(item.RentalInfo)
                                           </div>
                                       }
                                       @if (Model.IsEditable && item.AllowItemEditing)
                                       {
                                           var editCartItemUrl = Url.RouteUrl("Product", new { SeName = item.ProductSeName });
                                           editCartItemUrl = webHelper.ModifyQueryString(editCartItemUrl, "updatecartitemid=" + item.Id, null);
                                           <div class="edit-item">
                                               <a href="@editCartItemUrl">@T("Common.Edit")</a>
                                           </div>
                                       }
                                       @if (item.Warnings.Count > 0)
                                       {
                                           <div class="message-error">
                                               <ul>
                                                   @foreach (var warning in item.Warnings)
                                                   {
                                                       <li>@warning</li>
                                                   }
                                               </ul>
                                           </div>
                                       }
                                   </td>
                                   <td class="unit-price">
                                       <label class="td-title">@T("ShoppingCart.UnitPrice"):</label>
                                       <span class="product-unit-price">@item.UnitPrice</span>
                                   </td>
                                   <td class="quantity">
                                       <label class="td-title">@T("ShoppingCart.Quantity"):</label>
                                       @if (Model.IsEditable)
                                       {
                                           if (item.AllowedQuantities.Count > 0)
                                           {
                                               <select name="itemquantity@(item.Id)" class="qty-dropdown">
                                                   @foreach (var qty in item.AllowedQuantities)
                                                   {
                                                       <option selected="@qty.Selected" value="@qty.Value">@qty.Value</option>
                                                   }
                                               </select>
                                           }
                                           else
                                           {
                                               <input name="itemquantity@(item.Id)" type="text" value="@(item.Quantity)" class="qty-input"/>
                                           }
                                       }
                                       else
                                       {
                                            <span class="product-quantity">@item.Quantity</span>
                                       }
                                   </td>
                                   <td class="subtotal">
                                       <label class="td-title">@T("ShoppingCart.ItemTotal"):</label>
                                       <span class="product-subtotal">@item.SubTotal</span>
                                       @if (!String.IsNullOrEmpty(item.Discount))
                                       {
                                           <div class="discount">
                                               @T("ShoppingCart.ItemYouSave"): @item.Discount
                                           </div>
                                       }
                                   </td>
                               </tr>
                           }
                       </tbody>
                   </table>
               </div>
               if (Model.Items.Count > 0 && Model.DisplayTaxShippingInfo)
               {
               var inclTax = EngineContext.Current.Resolve<IWorkContext>().TaxDisplayType == TaxDisplayType.IncludingTax;
               //tax info is already included in the price (incl/excl tax). that's why we display only shipping info here
               //of course, you can modify appropriate locales to include VAT info there
               <div class="tax-shipping-info">
                   @T(inclTax ? "Wishlist.TaxShipping.InclTax" : "Wishlist.TaxShipping.ExclTax", Url.RouteUrl("Topic", new { SeName = Html.GetTopicSeName("shippinginfo") }))
               </div>
               }
               <div class="buttons">
                   @if (Model.IsEditable)
                   {
                       <input type="submit" name="updatecart" value="@T("Wishlist.UpdateCart")" class="button-2 update-wishlist-button" />
                   }
                   @if (Model.DisplayAddToCart)
                   {
                       <input type="submit" name="addtocartbutton" value="@T("ShoppingCart.AddToCart")" class="button-2 wishlist-add-to-cart-button" />
                   }
                   @if (Model.IsEditable && Model.EmailWishlistEnabled)
                   {
                       <input type="button" value="@T("Wishlist.EmailAFriend")" class="button-2 email-a-friend-wishlist-button" onclick="setLocation('@Url.RouteUrl("EmailWishlist")')" />
                   }
               </div>
               }
           </div>
       }
       else
       {
           <div class="no-data">
               @T("Wishlist.CartIsEmpty")
           </div>
       }
       @if (Model.IsEditable && Model.Items.Count > 0)
       {
           <div class="share-info">
               <span class="share-label">@T("Wishlist.YourWishlistURL"):</span>
               <a href="@Url.RouteUrl("Wishlist", new { customerGuid = Model.CustomerGuid })" class="share-link">@Url.RouteUrl("Wishlist", new { customerGuid = Model.CustomerGuid }, "http")</a>
           </div>
       }
   </div>
</div>